<script type='text/javascript' src='User Interface/JavaScript/js.js'></script>
<%@page import="ContentManagers.Servlets.ServletCustomerLogin"%>

<div id = "index_header">
    <div class = "links" id="default_links"> 
        
        <a href="index.jsp">Home</a>
        &nbsp;  &nbsp; 
        <a href="index_new_user.jsp">Register</a>
        &nbsp;  &nbsp;
        <a href="index_contact_info.jsp">Contact</a>
        
    </div>
    
    <% //This section is for the simple login lockout mechanism. 
            try{
                
            ServletCustomerLogin.resetIfTimeOut(request); 
            
            if(session.getAttribute("formLockout").toString().equals("off"))
                {  //login form will appear if attemptCount < 5
                    System.out.print(session.getAttribute("formLockout"));
                %>
    
    <div id="header_login">
                 <form name ="user_login" method="post" onsubmit="" action="ServletCustomerLogin">
                     <input class="headerloginbox" type="text" value="Username" id="usernameField" name="username" autocomplete ="off" onfocus="clearInitial(this, 'Username')" onblur="checkHeaderLogin()"/>
                        <input class="headerloginbox" type="password" value="Password" id="passwordField" name="password" autocomplete ="off" onfocus="clearInitial(this, 'Password')" onblur="checkHeaderLogin()"/>
                        <%
                            if(session.getAttribute("errorMessage")!=null)
                            {
                                if(session.getAttribute("errorMessage").equals("invalid"))
                                    out.println("<br>Invalid username or password. &nbsp;&nbsp;");

                                session.removeAttribute("errorMessage");
                            }
                            else
                                out.println("<Br>");
                            %>
                        <input type="submit" id="loginSubmitButton"name="SubmitUserLogin" value="Login"/>
                    
                 </form>
    </div>
                <% }
            else 
                { //display this div if attemptCount = 5
                
                %>
                    <div id="header_login">
                        <br>
                        You have exceeded the maximum
                        <br>login attempts within five minutes.
                    </div>
                
               <% } %>
               
               <% }
    catch(Exception e)
        {   session.setAttribute("formLockout", "off");
        }%>
</div>
